import React, { Component, useEffect } from "react";
import { BrowserRouter as Router, Routes, Link, Route, Navigate } from 'react-router-dom'
import Home_Page from "./layout/home/home";
import Login from "./layout/login/index"
import "./public.scss"

// RequireAuth 组件相当于一个拦截器，是否返回被拦截的组件要听他的
const RequireAuth = ({ children }) => {
	let authed = true
	return authed ? ( // 判断 localstorage 中登录状态是否为 true
		children
	) : (
		<Navigate to="/home" /> // 跳转到登录
	);
}

export default class router extends Component {
	render() {
		return (
			<>
				<Router>
					<Routes>
						<Route path={"/"} element={<Login />} ></Route >
						<Route path={"/*"} element={<Home_Page />} ></Route >
					</Routes>
				</Router>
			</>
		)
	}
}